package com.itheima.controller;

import com.itheima.User;
import com.itheima.service.UserService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("userServlet")
public class UserController {
    @Reference
    private UserService userService;

    @RequestMapping("login")
    public String login(@RequestBody User user) {
        User u = userService.login(user.getUsername(), user.getPassword());
        if(u != null){
            return "true";
        }else {
            return "false";
        }
    }
}
